Introduction
Introductions This is an introduction to setting up your openfl environment in developing your very first 2D video game. While 2D is OpenFL's primary focus of development, 3D games are still possible with the display3D package. For the purposes of these tutorials, 2D will be the main focus. There are plenty of 3D libraries for OpenFL if 3D is something you would like to get into. Installation To install OpenFL, you should have already installed Haxe. If not, go to haxe.org and download and install the appropriate package for your operating system. Once installed, open Terminal (Linux or Mac) or Command Prompt (Windows) and type the following: haxelib install openfl We also recommend downloading other libraries with OpenFL. When downloading OpenFL, it will also install pre-requisites such as Lime, necessary for building applications for native platforms. Lime is a core component of OpenFL, but building a project in either has differences. Please see the section "Lime vs OpenFL" below. You may optionally (recommended) setup your openfl environment which allows you to use command shortcuts. On Windows, this will modify your PATH environment variable, so be sure to open Command Prompt in administrator mode for this to work (Windows Vista or later). Alternatively, disabling UAC (User Account Control) also works. If you have Stencyl 3.x installed, Stencyl would have already installed and setup your Haxe environment to build Stencyl projects. If this is the case, and you have errors attempting to build OpenFL projects with Stencyl installed, you can simply change the Haxe library path. Using the following command: haxelib setup Will allow you to specify a new path for locating installed libraries. You may need to change this again if you use Stencyl, or other similar IDE's that uses OpenFL, again. To setup your OpenFL environment for shortcuts, type the following command: haxelib run openfl setup platform The ''haxelib run ''command locates a file called "run.n" in the target library's directory. This is a Neko module that is executed when you press enter. This is similar to a command-line tool with an interface similar to Terminal/Command Prompt, and is often useful when using specific tools in a haxe library. The above command will setup your environment for the platform you work on. The official OpenFL website has platform-specific tutorials which are better explained than this regarding the setup of ones environment. If shortcut commands still do not work after executing "openfl setup" in Administrator Mode, try restarting command prompt for the changes to take effect. Lime vs OpenFL Lime and OpenFL work in their own ways, but OpenFL relies on Lime to build native platform applications. OpenFL's code-base is designed with the purposes of game development and consists of a framework of tools to make such a thing work. It is comprised of several tools, including Lime, with the ability to build for multiple platforms. Lime, on the other hand, has a code-base designed with a more general-purpose approach to desktop application development, such as GUI interfaces and can wrap libraries for platform-specific code, such as WxWidgets or Qt. Because of Lime's general purpose-like approach, Lime is more difficult to learn but provides an easier approach to developing cross-platform desktop applications. While Lime is catered mainly for desktop application development, it does also support HTML5 and Flash through the exposure of the Canvas, DOM and Flash. There may be tutorials for Lime, but may be very broad. However, Lime is particularly useful for more control over OpenFL applications - modifying otherwise readonly properties - such as window resizing, enabling/disabling vsync, antialiasing, and other such options. External Resources * Basic Commands * Official OpenFL learning